﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class rename : System.Web.UI.Page
{
    /// <summary>
    /// 需回调的父窗体控件ID，会调用此控件上的click方法。
    /// </summary>
    private string parentCallBackControlId;
    EQT.Dal.DaTfiles datf = DevFuture.Common.WorkContext.AppCtx.GetObject("DaTfiles") as EQT.Dal.DaTfiles;
    public string ParentCallBackControlId
    {
        get { return parentCallBackControlId; }
        set { parentCallBackControlId = value; }
    }
    

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            LabelFileID.Text = Request.QueryString["fileid"];
            TextBoxOldName.Text = Server.HtmlDecode( Request.QueryString["filename"]);
            parentCallBackControlId = Request.QueryString["pccid"];

            if (String.IsNullOrEmpty(LabelFileID.Text)||String.IsNullOrEmpty(parentCallBackControlId))
            {
                Utility.SiteError("URL错误，缺失必须参数：fileid,pccid");
            }

        }
    }
    protected void BtnOk_Click(object sender, EventArgs e)
    {
        if (TextBoxNewName.Text.Trim().Length > 0)
        {
            
            datf.RenameFile(LabelFileID.Text, TextBoxNewName.Text.Trim());


            Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript", "closeRefresh()", true);
        }

    }
}
